package com.atguigu.spzx.manager.mapper;

import com.atguigu.spzx.model.dto.product.CategoryExcelDTO;
import com.atguigu.spzx.model.entity.product.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoryMapper {
//    @Insert()
//    @Update()
//    @Delete()
    @Select(value = "SELECT * FROM category WHERE is_deleted = 0 " +
            "AND parent_id = #{pid,jdbcType=BIGINT}")
    List<Category> selectByPid(Long pid);
    @Select(value = "SELECT COUNT(1) FROM category WHERE is_deleted = 0  AND parent_id = #{id,jdbcType=BIGINT}")
    Long selectCountByPid(Long id);

    void saveBatch(List<CategoryExcelDTO> list);

    Long selectCountByCondition(CategoryExcelDTO data);

    List<CategoryExcelDTO> selectAll();

    Category selectById(Long id);
}
